file = {}

-- 写文件
function file.write(filePath, str)
    -- open file
    local f = io.open(filePath, "w")
    if not f then
        return false
    end
    -- write file
    if f:write(str or "") == nil then
        return false
    end
    io.close(f)
    return true
end

-- 读取文件
function file.read(filePath)
    -- open file
    local f = io.open(filePath, "r")
    if not f then
        return "", "no find file! " .. filePath
    end
    -- read file
    local content = f:read("*a")
    io.close(f)
    return content
end
